local yinji = fk.CreateSkill{
  name = "mod__yinji",
  frequency = Skill.Compulsory,
}
local yinji_ = {
  anim_type = "special", 
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(self) and target == player and player.phase == Player.Finish then
      local room = player.room
      return not table.contains(table.filter(room.alive_players, function(p)
        return table.every(room:getOtherPlayers(p), function(p2)
          return p2.hp < p.hp
        end)
      end), player)
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local choice = "jinji_maxhp"
    if player:isWounded() then
      choice = room:askForChoice(player, {"yinji_hp", "jinji_maxhp"}, self.name, nil)
    end
    if choice == "yinji_hp" then
      room:recover{
        num = 1,
        who = player,
        skillName = self.name,
      }
    else
      room:changeMaxHp(player, 1)
    end
  end,
}
yinji:addEffect(fk.EventPhaseStart, yinji_)
return yinji